﻿<%@ page contentType="text/html;charset=UTF-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>用户列表</title>
<link rel="stylesheet" type="text/css" href="<s:property value="staticsRoot"/>/css/style.css"/>
<script type="text/javascript" src="<s:property value="staticsRoot"/>/js/jquery-1.8.3.min.js"></script>
<script type="text/javascript" src="<s:property value="staticsRoot"/>/js//My97DatePicker/WdatePicker.js"></script>
<script type="text/javascript">
$(document).ready(function() {
    $(".data tr:odd").css("background","#fff");
});

</script>
<s:if test="oper == 'success'">
<script type="text/javascript">
	alert("操作成功!");
</script>
</s:if>
</head>

<body id="user_mag">
<div class="right">
	<h3 class="title box">
    	当前位置：k吧后台管理&nbsp;&gt;&gt;&nbsp;用户管理&nbsp;&gt;&gt;&nbsp;列表
    </h3>
    <form name="form1" id="form1" action="userList.html" method="post">
    <table cellpadding="0" cellspacing="0" width="100%" class="table_top box">
    	<tr>
        	<td width="60%" height="50" align="right">
        		用户状态：
            	<select class="select" name="status">
                	<option value="0" <s:if test='status == 0 || status == null'>selected="selected"</s:if>>正常</option>
                	<option value="1" <s:if test='status == 1'>selected="selected"</s:if>>黑名单</option>
                </select>
                                          用户ID：
                <input type="text" class="i_text" id="userId" name="userId" value="<s:property value='userId' />"/>&nbsp;
                
            </td>
            <td align="left" style="padding-left:10px;">
            	<div class="lit_btn">
                    <a href="#" onclick="query()">查&nbsp;询</a>
                </div>
            </td>
        </tr>
        <tr>
        	<td width="60%" height="50" align="right">
        		禁言开始时间：
            	<input type="text" name="forbidBeginTime" class="Wdate" onclick="WdatePicker()" value=""/>
                                          禁言结束时间：
                <input type="text" name="forbidEndTime" class="Wdate" onclick="WdatePicker()" value=""/>
                
            </td>
            <td align="left" style="padding-left:10px;">
            </td>
        </tr>
        
    </table>
    <table cellpadding="0" cellspacing="0" width="100%" class="data">
    	<tr>
        	<td width="10%" height="29" align="center">用户ID</td>
            <td width="10%" align="center">用户昵称</td>
            <td width="5%" align="center">发帖数</td>
            <td width="5%" align="center">回复数</td>
            <td width="5%" align="center">被回复数</td>
            <td width="5%" align="center">加精数</td>
            <td width="8%" align="center">管理员</td>
            <td width="5%" align="center">状态</td>
            <td width="15%" align="center">禁言时间</td>
            <td width="15%" align="center">修改时间</td>
            <td>操作</td>
        </tr>
        <s:iterator value="list" var="user">
        	<tr>
	        	<td height="29"><s:property value="#user.userId"/></td>
	            <td><s:property value="userMap.get(#user.userId).nick" /></td>
	            <td><s:property value="#user.threadCount"/></td>
	            <td><s:property value="#user.replyCount"/></td>
	            <td><s:property value="#user.threadRepliedCount"/></td>
	            <td><s:property value="#user.digestThreadCount"/></td>
	            <td><s:property value="#user.adminRoleStr"/></td>
	            <td><s:property value="#user.statusStr"/></td>
	            <td><s:date name="#user.forbidBeginTime" format="yyyy-MM-dd HH:mm:ss" />&nbsp;&nbsp;<s:date name="#user.forbidEndTime" format="yyyy-MM-dd HH:mm:ss" /> </td>
	            <td><s:date name="#user.modifiedTime" format="yyyy-MM-dd HH:mm:ss" /> </td>
	            <td>
	            <a href="#" onclick="forbid('<s:property value="#user.userId"/>')">禁言</a>
	            <s:if test="#user.status == 0">
	            <a href="userUpd.html?userId=<s:property value='#user.userId'/>&status=1">加入黑名单</a>
	            </s:if>
	            <s:else>
	            <a href="userUpd.html?userId=<s:property value='#user.userId'/>&status=0">取消黑名单</a>
	            </s:else>
	            <s:if test="#user.adminRole == 0">
	            <a href="userUpd.html?userId=<s:property value='#user.userId'/>&adminRole=1">设置为管理员</a>
	            </s:if>
	            <s:else>
	            <a href="userUpd.html?userId=<s:property value='#user.userId'/>&adminRole=0">取消管理员</a>
	            </s:else>
	            </td>
        	</tr>
        </s:iterator>
    </table>
    <%@include file="page.jsp" %>
    </form>
</div>

<script type="text/javascript">
	function query(){
		$("#form1").submit();
	}
	function doSearch(pageNumber){
		if(pageNumber <= 0){
			pageNumber = 1;
		}	
		$("#page").val(pageNumber); 
		$("#form1").submit(); 
	}

	function forbid(userId){
		$("#userId").val(userId);
		$("#form1").attr("action", "userForbid.html");
		$("#form1").submit(); 
	}	
</script>
</body>
</html>
